// JavaScript Document
WebFontConfig = {
    google: {families: ['Lato:400,300,700:latin']}
};
(function() {
    var wf = document.createElement('script');
    wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
            '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
    wf.type = 'text/javascript';
    wf.async = 'true';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(wf, s);
})();

// Fraction Slider
$(window).load(function() {
    $('.slider').fractionSlider({
        'fullWidth': true,
        'controls': true,
        'pager': true,
        'backgroundAnimation': false,
    });



});

$(document).ready(function() {
    //On mouse over those thumbnail
    $('.item').hover(function() {
        //Display the caption
        $(this).find('.caption').stop().fadeIn(200);
    }, function() {
        //Hide the caption
        $(this).find('.caption').stop().fadeOut(200);
    });

    $("#btnchkdomain").click(function() {
        var domain = $("#txtchkdomain").val();
        var url = $("#hdchkdomain").val();
        var frmtoken = $("#frmtoken").val();
        
        var request = $.ajax({
            url: url,
            type: "POST",
            data: {
                domain: domain,
                task: "domainchecklists.check",
            },
            dataType: "html"
        });
        request.done(function(msg) {
            $("#resultchkdomain").html(msg);
        });
        request.fail(function(jqXHR, textStatus) {
            alert("Request failed: " + textStatus);
        });
    });
});


//Header Animation
$(function() {
    $('#ad a')
            .css({backgroundPosition: "0 -200px"})
            .mouseover(function() {
                $(this).stop().animate({backgroundPosition: '0 -50px'}, {duration: 400})
            })
            .mouseout(function() {
                $(this).stop().animate({backgroundPosition: '0 -200px'}, {duration: 300, complete: function() {
                        $(this).css({backgroundPosition: "0 -200px"})
                    }})
            })

    $('#social img')
            .mouseover(function() {
                $(this).stop().animate({top: '-47px'}, {duration: 100})
            })
            .mouseout(function() {
                $(this).stop().animate({top: '0'}, {duration: 100})
            })



    $('.more_project a')
            .mouseover(function() {
                $(this).stop().animate({width: '340px'}, {duration: 200})
            })
            .mouseout(function() {
                $(this).stop().animate({width: '300px'}, {duration: 100})
            })

    $('.link_btn a')
            .mouseover(function() {
                $(this).stop().animate({width: '150px'}, {duration: 200})
            })
            .mouseout(function() {
                $(this).stop().animate({width: '130px'}, {duration: 100})
            })

    $('.chat_icon a')
            .mouseover(function() {
                $(this).stop().animate({top: '-10'}, {duration: 100})
            })
            .mouseout(function() {
                $(this).stop().animate({top: '0'}, {duration: 100})
            })

    $('.sub_item')
            .mouseover(function() {
                $(this).find('.sub_bg').stop().animate({top: '62'}, {duration: 100})
            })
            .mouseout(function() {
                $(this).find('.sub_bg').stop().animate({top: '-100'}, {duration: 100})
            })


    $('.left_project')
            .mouseover(function() {
                $(this).stop().animate({left: '0'}, {duration: 200})
            })
            .mouseout(function() {
                $(this).stop().animate({left: '-152'}, {duration: 100})
            })

    $('.right_project')
            .mouseover(function() {
                $(this).stop().animate({right: '0'}, {duration: 200})
            })
            .mouseout(function() {
                $(this).stop().animate({right: '-152'}, {duration: 100})
            })

    $('.list')
            .mouseover(function() {
                $(this).stop().transition({rotate: '90deg'}, 200)
            })

            .mouseout(function() {
                $(this).stop().transition({rotate: '0deg'}, 200)
            })
});